package com.baike.data;

import com.baike.em.ConstantEnum;

import java.io.Serializable;

public class Result<T> implements Serializable {

    private Integer code;//状态码

    private String message;//提示信息

    private T result;//数据信息

    public Result() {
    }

    public static Result build(ConstantEnum e){
        Result result = new Result();
        result.setCode(e.getCode());
        result.setMessage(e.getMessage());
        return result;
    }

    public Result(Integer code, String message, T result) {
        this.code = code;
        this.message = message;
        this.result = result;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getResult() {
        return result;
    }

    public Result setResult(T result) {
        this.result = result;
        return this;
    }
}
